#include "sort.hpp"
#include "tools.hpp"
#include <algorithm>
#include <cstddef>
#include <cstdio>
#include <cstdlib>


static void print(int* arr, size_t len)
{
    for (size_t i = 0; i < len; i++) {
        std::printf("%d, ", arr[i]);
    }
}

int main()
{
    lxj::Time        time;
    lxj::Random<int> rand;
    int              arr[10];
    for (int i = 0; i < 10; i++) {
        int value = rand(0, 100);
        while (std::find(arr, arr + 10, value) != arr + 10) {
            value = rand(0, 100);
        }
        arr[i] = value;
    }
    print(arr, 10);
    auto index = lxj::peakIndex(arr, 10);
    if (!index) {
        std::puts("此为空数组");
    }
    else {
        std::printf("\n下标为：%d\n找到的数字为：%d\n", index.value(), arr[index.value()]);
    }
}